
public class Subset {
	

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		RandomizedQueue<String> q = new RandomizedQueue<String>();
		int k = Integer.parseInt(args[0]);
		while( !StdIn.isEmpty()) {
			String readString = StdIn.readString();
			q.enqueue(readString);
		}
		
		for (int i = 0; i < k; i++) {
			System.out.println(q.sample());
		}

	}

}
